package com.bangcommunity.bbframe.sdm.aop.handler;

import org.aspectj.lang.ProceedingJoinPoint;

import java.lang.reflect.Method;

/**
 * Created by tanghc on 17/1/18.
 */
public abstract class ExceptionHandler extends AbstractorAopHandler {

    protected Exception targetException;

    public void setTargetException(Exception targetException) {
        this.targetException = targetException;
    }

    @Override
    protected boolean doHandler(ProceedingJoinPoint pjp, Object[] args, Method method, String className) {
        try {
            return doExceptionHandler(targetException, pjp, args, method, className);
        } catch (Exception e) {
            logger.error("aop ExceptionHandler exception", e);
        }
        return true;
    }

    protected abstract boolean doExceptionHandler(Exception targetException, ProceedingJoinPoint pjp, Object[] args,
            Method method, String className);
}
